﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class light : MonoBehaviour
{
    private float transvalue;
    private float startTime;

    // Start is called before the first frame update
    void Start()
    {
        transform.GetComponent<RawImage>().color =
               new Color(this.GetComponent<RawImage>().color.r, this.GetComponent<RawImage>().color.g, this.GetComponent<RawImage>().color.b,0);
    }

    // Update is called once per frame
    void Update()
    {
        if(Time.time-startTime>=0.2f)
        {
//<<<<<<< HEAD
          
//            startTime += 0.5f;
//            transform.GetComponent<RawImage>().color =
//                new Color(this.GetComponent<RawImage>().color.r, this.GetComponent<RawImage>().color.g, this.GetComponent<RawImage>().color.b,transvalue++);
//=======
            startTime += 0.2f;
            transvalue += 0.1f;
            if(transvalue<1.0f)
            {
                transform.GetComponent<RawImage>().color =
               new Color(this.GetComponent<RawImage>().color.r, this.GetComponent<RawImage>().color.g, this.GetComponent<RawImage>().color.b, transvalue);
            }
            else if(transvalue>=1.0f && transvalue<2.0f)
            {
                transform.GetComponent<RawImage>().color =
                new Color(this.GetComponent<RawImage>().color.r, this.GetComponent<RawImage>().color.g, this.GetComponent<RawImage>().color.b,1-transvalue%1);
            }
            else
            {
                transvalue = 0;
            }
//>>>>>>> 203e700ecad55b8eed5d69b0d92dd5c737eb5061
        }
        
    }
}
